package com.zerocarbon.framework.common.model;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;

import javax.validation.groups.Default;
import java.io.Serializable;
import java.util.Date;

public class BaseEntity implements Serializable {

    public static final String CREATE_TIME = "createTime";
    public static final String UPDATE_TIME = "updateTime";
    public static final String CREATE_TIME_COLUMN = "create_time";
    public static final String UPDATE_TIME_COLUMN = "update_time";
    private static final long serialVersionUID = -4603650115461757622L;
    @TableField(
            value = "create_time",
            fill = FieldFill.INSERT
    )
    protected Date createTime;
    @TableField(
            value = "update_time",
            fill = FieldFill.INSERT_UPDATE
    )
    protected Date updateTime;

    public Date getCreateTime() {
        return this.createTime;
    }

    public Date getUpdateTime() {
        return this.updateTime;
    }

    public BaseEntity setCreateTime(Date createTime) {
        this.createTime = createTime;
        return this;
    }

    public BaseEntity setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
        return this;
    }

    public BaseEntity() {
    }

    public BaseEntity(Date createTime, Date updateTime) {
        this.createTime = createTime;
        this.updateTime = updateTime;
    }

    public String toString() {
        return "BaseEntity(super=" + super.toString() + ", createTime=" + this.getCreateTime() + ", updateTime=" + this.getUpdateTime() + ")";
    }

    public interface Update extends Default {
    }

    public interface Save extends Default {
    }

}
